﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Public;
using System.Data;

namespace DAL
{
    public class TuyenBayDAL
    {
        clsKetNoi kn = new clsKetNoi();
        public DataTable LoadTuyenBay()
        {
            return kn.LayDuLieu("TuyenBay_Load");
        }

        public int ThemTuyenBay(TuyenBayPublic p)
        {
            int Nparameter = 3;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "MaTuyenBay"; value[0] = p.MaTuyenBay;
            name[1] = "SanBayDi"; value[1] = p.SanBayDi;
            name[2] = "SanBayDen"; value[2] = p.SanBayDen;
            return kn.Update("TuyenBay_Insert", name, value, Nparameter);
        }
       
        public DataTable LayMaTuyenBay(TuyenBayPublic p)
        {
            int Nparameter = 2;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@SanBayDi";
            value[0] = p.SanBayDi;
            name[1] = "@SanBayDen";
            value[1] = p.SanBayDen;
            return kn.LayDuLieu("LayMaTuyenBay", name, value, Nparameter);
        }
    }
}
